package com.xiaoshuidi.cloud.module.rooms.service;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.apartment.vo.ApartmentVO;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.roomhouse.vo.*;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomHouse;
import com.xiaoshuidi.cloud.module.rooms.vo.RoomHouseRespVo;

import java.time.LocalDate;
import java.util.List;

public interface RoomHouseService extends IService<RoomHouse> {

    CommonResult<Boolean> insertBatch(List<RoomHouse> roomHouses);

    RoomHouse insert(RoomHouse roomHouse);

    /**
     * 分散式房源新增
     * @param roomHouseId
     * @param loginUserId
     * @return
     */
    CommonResult<RoomCreateRespVo> addRoomHouse(Long roomHouseId, Long loginUserId);


    /**
     * 集中式新增房源
     *
     * @param concentratedAddVO
     * @param tenantId
     * @return
     */
    CommonResult<Boolean> concentratedAdd(ConcentratedAddVO concentratedAddVO, Long tenantId);

    /**
     * 编辑时获取房源信息
     * @param roomHouseId
     * @param tenantId
     * @return
     */
    CommonResult<RoomHouseInfoRespVO> getRoomHouseInfo(Long roomHouseId, Long tenantId);

    /**
     * 集中式编辑房源信息
     * @param editReqVO
     * @return
     */
    CommonResult<Boolean> concentratedEdit(ConcentratedRoomHouseEditReqVO editReqVO);

    /**
     * 分散式新增房源
     *
     * @param noConcentratedAddVO
     * @param tenantId
     * @return
     */
    CommonResult<Boolean> noConcentratedAdd(NoConcentratedAddVO noConcentratedAddVO, Long tenantId);

    /**
     * 分散式编辑房源信息
     * @param editReqVO
     * @return
     */
    CommonResult<Boolean> noConcentratedEdit(NoConcentratedRoomHouseEditReqVO editReqVO);

    /**
     * 根据房源id删除房源
     * @param roomHouseId 房源id
     * @return
     */
    CommonResult<Boolean> delete(Long roomHouseId);

    /**
     * 房间冻结
     * @param roomHouseId 房源id
     * @return 房态id
     */
    CommonResult<Long> roomFreeze(Long roomHouseId);

    /**
     * 房间解冻
     * @param roomHouseId
     * @return
     */
    CommonResult<Long> roomUnFreeze(Long roomHouseId);

    /**
     * 房间报修
     * @param roomHouseId
     * @return
     */
    CommonResult<Boolean> repair(Long roomHouseId);

    /**
     * 房间报修 - 完成
     * @param roomHouseId
     * @return
     */
    CommonResult<Boolean> repairFinish(Long roomHouseId);

    /**
     * 根据id列表查询对应房间信息
     * @param ids
     * @return
     */
    CommonResult<List<RoomHouseRespVo>> getRoomHouseByIds(List<Long> ids);

    /**
     * 分散式房源导入
     * @param req
     * @param
     * @return
     */
    Boolean  houseImport(HouseImportReq req,String key);


    /**
     *
     * @param list  房源信息
     * @param apartmentId 公寓id
     * @param tenantId
     * @param userId
     * @param type 整租/合租
     * @return
     */

    Boolean batchNoConcentratedAdd(String esKey,List<PartLeaseTemplateVo> list,Long apartmentId,Long tenantId,Long userId,String type);

    /**
     * 根据房源id获取房间详情
     * @param roomHouseId
     * @return
     */
    CommonResult<RoomHouseRespVo> getRoomHouseinfoById(Long roomHouseId);
    CommonResult<RoomHouseRespVo> queryByHouseAddr(String roomHouseAddr,Long apartmentId);

    /**
     * 所有小区/楼栋名称的树形结构
     * @param isConcentrated
     * @return
     */
    CommonResult<List<GetRoomHouseTreeRespVO>> getRoomHouseTree(Boolean isConcentrated);

    /**
     * 获取所有房源列表
     *
     * @param tenantId       租户id
     * @param apartmentId    门店id
     * @param isConcentrated 是否集中式
     * @param houseState     房态 RentStatusEnum.value
     * @param isLock
     * @param onlyShowPrimaryRoomHouse 是否只显示主房源
     * @return
     */
    CommonResult<List<AllRoomHouseRespVO>> allRoomHouse(Long tenantId, Long apartmentId, Boolean isConcentrated, String houseState, Boolean isLock, Boolean onlyShowPrimaryRoomHouse);


    /**
     * 集中式-根据小区信息和楼栋回显房源信息
     * @param province 小区所在省
     * @param city 小区所在市
     * @param district 区
     * @param street 街道
     * @param areaName 小区名
     * @param buildingNo 楼栋号
     * @return
     */
    CommonResult<ConcentratedAddVO> getRoomHouseInfoByAreaBuilding(String province, String city, String district, String street, String address, String areaName, String buildingNo);

    /**
     * 分散式-根据小区信息和楼栋单元回显房源信息
     * @param province
     * @param city
     * @param district
     * @param street
     * @param address
     * @param areaName
     * @param buildingNo
     * @param unitNo
     * @return
     */
    CommonResult<NoConcentratedEchoRespVO> getNoConcentrateRoomHouseInfoByAreaBuilding(String province, String city, String district, String street, String address, String areaName, String buildingNo, String unitNo);

    /**
     * 冻结部门下的所有房源
     * @param deptId
     * @return
     */
    CommonResult<Boolean> roomFreezeByDeptId(Long deptId);

    /**
     * 解冻部门下的所有房源
     * @param deptId
     * @return
     */
    CommonResult<Boolean> roomUnFreezeByDeptId(Long deptId);

    /**
     * 根据房源id获取对应门店信息
     * @param roomHouseId
     * @return
     */
    CommonResult<ApartmentVO> getApartmentInfoByRoomHouse(Long roomHouseId);

    /**
     * 根据租客的手机号查询对应的房源信息
     * @param tenantId 租户ID
     * @param phone 租客手机号
     * @return
     */
    CommonResult<GetRoomHouseByTenantPhoneRespVO> getRoomHouseByTenantPhone(Long tenantId, String phone);

    /**
     * 查看房源信息
     * @param roomHouseId
     * @return
     */
    CommonResult<HouseInfoRespVO> roomHouseInfo(Long roomHouseId);

    /**
     * 续租合同账单支付后,更新房源的续租合同信息
     * @param roomHouseId
     * @param renewalContractId
     * @param renewalEndTime
     * @return
     */
    CommonResult<Boolean> updateContractInfoByRenewal(Long roomHouseId, Long renewalContractId, LocalDate renewalEndTime);

    List<RoomHouse> selectListByIds(List<String> ids);

    CommonResult<Boolean> isCleanRoomHouseEdit(Long roomHouseId, Boolean isClean);

    CommonResult<Boolean> isRepairRoomHouseEdit(Long roomHouseId, Boolean isRepair);

    /**
     * 分散式房源出租形式变更
     * @param editReqVO
     * @return
     */
    CommonResult<Boolean> noConcentratedEditRentalMethod(NoConcentratedRoomHouseEditReqVO editReqVO);

    /**
     * 切换为合租时获取子房源信息
     * @param roomHouseId
     * @return
     */
    CommonResult<List<SlaveRoomInfo>> getSubListingsWhenSwitchingToSharedApartments(Long roomHouseId);

    /**
     * 样板房切换
     * @param roomHouseId
     * @return
     */
    CommonResult<Boolean> screed(Long roomHouseId);

    /**
     * 根据id列表查询对应房间基本信息和户型信息
     * @param ids
     * @return
     */
    CommonResult<List<RoomHouseRespVo>> getRoomHouseAndLayoutByIds(List<Long> ids);

}
